package com.ruoyi.heatwork.demotcp.rest;

import com.ruoyi.heatwork.demotcp.tcp.TcpClient;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.math.BigDecimal;

@RestController
public class TcpRest {

    @GetMapping
    public void tcp(@RequestParam Integer port, @RequestParam String ip,
                    @RequestParam Integer subNum) throws Exception {
        VertxOptions vertxOptions = new VertxOptions();
        vertxOptions.setBlockedThreadCheckInterval(999888777666L);
        vertxOptions.setMaxEventLoopExecuteTime(999888777666L);
        Vertx.vertx(vertxOptions).deployVerticle(new TcpClient(port, ip, subNum));

    }

    public static void main(String[] args) {
        System.out.println((BigDecimal.valueOf(-10).compareTo(BigDecimal.ZERO) != 0));
        System.out.println((BigDecimal.valueOf(-10).compareTo(BigDecimal.ZERO)));
    }
}
